<html>
<head>
    <title>XamlPhysics - Restitution</title>
    <script src="CodeMirror/js/highlight.js" type="text/javascript"></script>
    <script src="CodeMirror/js/stringstream.js" type="text/javascript"></script>
    <script src="CodeMirror/js/tokenize.js" type="text/javascript"></script>
    <script src="CodeMirror/js/parsexml.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="CodeMirror/css/xmlcolors.css"/>
</head>
<body>
    <h1>Restitution</h1>
    <p>
        The restitution is how bouncy a body is.
        It can be changed by setting the RestitutionCoefficient property.
        A RestitutionCoefficient of 0 will result in no bounce, while a RestitutionCoefficient of 1 will result in infinite bouncing.
        When 2 bodies collide the resulting restitution is the larger value.
        The default is 0.5.
    </p>
    <div id="silverlightControlHost">
        <object data="data:application/x-silverlight-2," height="300" 
            type="application/x-silverlight-2" width="400">
            <param name="source" value="XamlPhysics.Samples.xap" />
            <param name="background" value="white" />
            <param name="minRuntimeVersion" value="4.0.50826.0" />
            <param name="autoUpgrade" value="true" />
            <param name="InitParams" value="Sample=Restitution" />
    <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration:none">
 			      <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
		      </a>
	        </object>
        <iframe id="_sl_historyFrame" 
            style="visibility:hidden;height:0px;width:0px;border:0px"></iframe>
    </div>

    <textarea id="Code1" cols="120" rows="15">
<Rectangle Canvas.Left="209" Canvas.Top="126" Width="50" Height="50" Fill="DarkRed">
    <physics:PhysicalBox.Body>
        <physics:RectangleBody>
            <physics:RectangleBody.Geometries>
                <physics:RectangleGeometry RestitutionCoefficient="0" />
            </physics:RectangleBody.Geometries>
        </physics:RectangleBody>
    </physics:PhysicalBox.Body>
</Rectangle>
<Rectangle Canvas.Left="309" Canvas.Top="126" Width="50" Height="50" Fill="DarkGoldenrod">
    <physics:PhysicalBox.Body>
        <physics:RectangleBody>
            <physics:RectangleBody.Geometries>
                <physics:RectangleGeometry RestitutionCoefficient="0.2" />
            </physics:RectangleBody.Geometries>
        </physics:RectangleBody>
    </physics:PhysicalBox.Body>
</Rectangle>
<Rectangle Canvas.Left="423" Canvas.Top="126" Width="50" Height="50" Fill="DarkBlue">
    <physics:PhysicalBox.Body>
        <physics:RectangleBody>
            <physics:RectangleBody.Geometries>
                <physics:RectangleGeometry RestitutionCoefficient="0.4" />
            </physics:RectangleBody.Geometries>
        </physics:RectangleBody>
    </physics:PhysicalBox.Body>
</Rectangle>
<Rectangle Canvas.Left="529" Canvas.Top="126" Width="50" Height="50" Fill="DarkCyan">
    <physics:PhysicalBox.Body>
        <physics:RectangleBody>
            <physics:RectangleBody.Geometries>
                <physics:RectangleGeometry RestitutionCoefficient="0.6" />
            </physics:RectangleBody.Geometries>
        </physics:RectangleBody>
    </physics:PhysicalBox.Body>
</Rectangle>
<Rectangle Canvas.Left="629" Canvas.Top="126" Width="50" Height="50" Fill="DarkKhaki">
    <physics:PhysicalBox.Body>
        <physics:RectangleBody>
            <physics:RectangleBody.Geometries>
                <physics:RectangleGeometry RestitutionCoefficient="0.8" />
            </physics:RectangleBody.Geometries>
        </physics:RectangleBody>
    </physics:PhysicalBox.Body>
</Rectangle>
<Rectangle Canvas.Left="733" Canvas.Top="126" Width="50" Height="50" Fill="DarkGreen">
    <physics:PhysicalBox.Body>
        <physics:RectangleBody>
            <physics:RectangleBody.Geometries>
                <physics:RectangleGeometry RestitutionCoefficient="1" />
            </physics:RectangleBody.Geometries>
        </physics:RectangleBody>
    </physics:PhysicalBox.Body>
</Rectangle>

<Rectangle Canvas.Left="-100" Canvas.Top="768" Width="1240" Height="10" Fill="Black">
    <physics:PhysicalBox.Body>
        <physics:RectangleBody IsStatic="True">
            <physics:RectangleBody.Geometries>
                <physics:RectangleGeometry RestitutionCoefficient="0" />
            </physics:RectangleBody.Geometries>
        </physics:RectangleBody>
    </physics:PhysicalBox.Body>
</Rectangle>
    </textarea>

    <script type="text/javascript">
        function Highlight(Code) {
            var Text = document.createElement("pre");
            Text.style.fontFamily = "Courier New";

            function AddLine(Line) {
                for (var i = 0; i < Line.length; i++) Text.appendChild(Line[i]);
                Text.appendChild(document.createElement("br"));
            }
            highlightText(Code.value, AddLine);

            Code.parentElement.insertBefore(Text, Code);
            Code.parentElement.removeChild(Code);
        }
        Highlight(document.getElementById("Code1"));
    </script>
</body>
</html>